


class Bicycle:
    __key=True
    def __init__(self,model,color):
        self.model=model
        self.color=color
    def run(self,km):
        print(f"人力骑行了{km}千米")
    def open(self):
        if self.__key==True:
            print('open')
        else:
            print('no key')
class EBicycle(Bicycle):
    def __init__(self,model,color,valume):
        self.valume=valume
        super().__init__(model,color)
    def look_style(self):
        print(f"本车的类型为{self.model},本车的颜色为{self.color}")
    def fill_charge(self,vol):
        self.valume = self.valume + vol
        if self.valume<30:
            print(f"充了{vol}度电。现在的电量是{self.valume}")
        else:
            raise Exception("充电太多了，装不下了～")
    def run(self,km):
        power_key=self.valume*10
        rest_value=0
        if power_key>=km:
            print(f"我用电力骑行了{km}")
            rest_value=self.valume-km/10
        else:
            print(f"我用电力骑行了{power_key}千米")
            print("没电了")
            super().run(km - power_key / 10)
        return rest_value
if __name__ == '__main__':
    bike=EBicycle("23","red",11)
    bike.look_style()
    rest_valume=bike.run(100)
    print(f"剩余电量为{rest_valume}")
    bike.open()



